
<%@page contentType="text/html" pageEncoding="UTF-8"%>

<%@taglib prefix="f" uri="http://java.sun.com/jsf/core"%>
<%@taglib prefix="h" uri="http://java.sun.com/jsf/html"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
    "http://www.w3.org/TR/html4/loose.dtd">

<f:view>
    <html>
        <head>
            <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"/>
            <title>ICE HOCKEY MANAGER - Teams</title>
            <link rel="stylesheet" href="graphics/style.css" media="screen" />
        </head>
        <body>

            <div id="head">
                <h1><h:outputText value="Ice Hockey Manager"/></h1>
            </div>

            <h:form>
                <div id="top-panel">
                    <h:outputText value="#{msgs.logged_in_as}: #{manager.loginName} " />
                    <h:outputText value="(#{msgs.chosen_club}: #{manager.currentClub.name}) " rendered="#{manager.hasClub}" />
                    <h:commandButton value="#{msgs.logout}" action="#{manager.logout}" />
                </div>

                <ul id="menu">
                    <li>
                        <h:commandLink action="#{manager.editTeam}" value="#{msgs.my_team}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.browseOtherTeams}" value="#{msgs.other_teams}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editOffers}" value="#{msgs.offers}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editClub}" value="#{msgs.edit}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.editPassword}" value="#{msgs.change_pass}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.clubsList}" value="#{msgs.clubsList}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createClub}" value="#{msgs.createNewClub}" />
                    </li>
                    <li>
                        <h:commandLink action="#{manager.createLeague}" value="#{msgs.createNewLeague}" rendered="#{manager.isAdmin}" />
                    </li>
                </ul>

                <div id="content">
                    <div id="in">

                        <h2><h:outputText value="#{msgs.other_teams}"/></h2>
                        <h:form prependId="false">

                            <h:outputText value="#{msgs.league}" />
                            <h:selectOneListbox value="#{manager.league}" size="1">
                                <f:selectItems value="#{manager.allLeaguesList}" />
                                <f:converter converterId="LeagueConverter" />
                            </h:selectOneListbox>
                            <h:commandButton action="#{manager.selectLeague}" value="Select"/>
                            <h:messages />

                            <h3><h:outputText value="#{manager.league.name} (#{manager.league.country})"/></h3>
                            <h:dataTable value="#{manager.leagueClubsModel}" var="item" rowClasses="OddRow,EvenRow" columnClasses="clubName,stadiumName,loginName,action">
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{msgs.team}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.name}"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{msgs.stadium}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.stadium.name} (#{item.stadium.capacity} #{msgs.spectators})"/>
                                </h:column>
                                <h:column>
                                    <f:facet name="header">
                                        <h:outputText value="#{msgs.manager}"/>
                                    </f:facet>
                                    <h:outputText value="#{item.manager.login}"/>
                                </h:column>
                                <h:column>
                                    <h:commandButton action="#{manager.showTeam}" value="#{msgs.show}" />
                                </h:column>
                            </h:dataTable>
                        </h:form>
                    </div>
                </div>

                <div class="clr" />

            </h:form>


        </body>
    </html>
</f:view>

